import 'package:fish_redux/fish_redux.dart';
import 'package:flutter/cupertino.dart' hide Action;
import 'package:www.znpigai.teacher/global_store/state.dart';
import 'package:www.znpigai.teacher/utils/nav.dart';

import 'action.dart';
import 'state.dart';

Effect<ClassState> buildEffect() {
  return combineEffects(<Object, Effect<ClassState>>{
    ClassAction.onClick: _onClick,
  });
}

void _onClick(Action action, Context<ClassState> ctx) async {
  if (GlobalState.isTeacher) {
    Navigator.of(ctx.context).pushNamed(Nav.STUDENT_LIST, arguments: ctx.state);
  }
}
